#include "../StdInc.h"

namespace GSTrader
{
	namespace TradeBase
	{
		CAccountRegisterBank::CAccountRegisterBank()
		{
			m_nProviderId = -1;

			m_strBankId = "";
			m_strBankBranchId = "";
			m_strBankName = "";

			m_strBrokerId = "";
			m_strBrokerBranchId = "";
			m_strTradeDate = "";
			m_strTradeTime = "";
			m_strBankSerial = "";
			m_strSessionId = "";
			m_strCustomerName = "";
			m_strIdCardType = "";
			m_strIdentifiedCardNo = "";
			m_nCustType = 0;
			m_strBankAccount = "";
			m_strBankPassWord = "";
			m_strAccountId = "";
			m_strPassWord = "";
			m_nFutureSerial = 0;
			m_strTID = "";
			m_strCurrencyId = "";
			m_nOpenOrDestoryType = 0;
			m_strRegDate = "";
			m_strOutDate = "";
			m_nBankAccType = 0;
		}


		CAccountRegisterBank::~CAccountRegisterBank()
		{
		}

		CAccountRegisterBank::CAccountRegisterBank(const CAccountRegisterBank& r)
		{
			m_nProviderId = r.m_nProviderId;

			m_strBankId = r.m_strBankId;
			m_strBankBranchId = r.m_strBankBranchId;
			m_strBankName = r.m_strBankName;

			m_strBrokerId = r.m_strBrokerId;
			m_strBrokerBranchId = r.m_strBrokerBranchId;
			m_strTradeDate = r.m_strTradeDate;
			m_strTradeTime = r.m_strTradeTime;
			m_strBankSerial = r.m_strBankSerial;
			m_strSessionId = r.m_strSessionId;
			m_strCustomerName = r.m_strCustomerName;
			m_strIdCardType = r.m_strIdCardType;
			m_strIdentifiedCardNo = r.m_strIdentifiedCardNo;
			m_nCustType = r.m_nCustType;
			m_strBankAccount = r.m_strBankAccount;
			m_strBankPassWord = r.m_strBankPassWord;
			m_strAccountId = r.m_strAccountId;
			m_strPassWord = r.m_strPassWord;
			m_nFutureSerial = r.m_nFutureSerial;
			m_strTID = r.m_strTID;
			m_strCurrencyId = r.m_strCurrencyId;
			m_nOpenOrDestoryType = r.m_nOpenOrDestoryType;
			m_strRegDate = r.m_strRegDate;
		}

		string CAccountRegisterBank::GetLongName()
		{
			if (m_strBankAccount.empty())
			{
				return "";
			}
			int nLen = m_strBankAccount.length();
			int nStart = nLen - 3;
			if (nStart < 0)
				return "";
			string strAccount = "*************";
			strAccount += m_strBankAccount.substr(nStart, 3);

			string strLongName = m_strBankName;
			strLongName += " ";
			strLongName += m_strCurrencyId;
			strLongName += " ";
			strLongName += strAccount;
			return strLongName;
		}

		CAccountTransfer::CAccountTransfer()
		{
			m_dTradeAmount = 0;
			m_dFutureFetchAmount = 0;
			m_nFeePayFlag = 0;
			m_dCustFee = 0;
			m_dBrokerFee = 0;
			m_nTransferStatus = 0;
			m_strTradeCode = "";
			m_nErrorId = 0;
			m_strErrorMsg = "";
		}
	
		CAccountTransfer::~CAccountTransfer()
		{

		}

		CAccountTransfer::CAccountTransfer(const CAccountTransfer& r)
		{
			CAccountRegisterBank* pBank = (CAccountRegisterBank*)(&r);
			this->CAccountRegisterBank::CAccountRegisterBank(*pBank);

			m_dTradeAmount = r.m_dTradeAmount;
			m_dFutureFetchAmount = r.m_dFutureFetchAmount;
			m_nFeePayFlag = r.m_nFeePayFlag;
			m_dCustFee = r.m_dCustFee;
			m_dBrokerFee = r.m_dBrokerFee;
			m_nTransferStatus = r.m_nTransferStatus;
			m_strTradeCode = r.m_strTradeCode;
			m_nErrorId = r.m_nErrorId;
			m_strErrorMsg = r.m_strErrorMsg;
		}

		CAccountMoney::CAccountMoney()
		{
			m_strTradeCode = "";
		    m_strDigest = "";

			m_dBankUseAmount = 0;
			m_dBankFetchAmount = 0;
			m_nErrorId = 0;
			m_strErrorMsg = "";
		}

		CAccountMoney::~CAccountMoney()
		{

		}

		CAccountMoney::CAccountMoney(const CAccountMoney& r)
		{
			CAccountRegisterBank* pBank = (CAccountRegisterBank*)(&r);
			this->CAccountRegisterBank::CAccountRegisterBank(*pBank);

			m_strTradeCode = r.m_strTradeCode;
			m_strDigest = r.m_strDigest;

			m_dBankUseAmount = r.m_dBankUseAmount;
			m_dBankFetchAmount = r.m_dBankFetchAmount;
			m_nErrorId = r.m_nErrorId;
			m_strErrorMsg = r.m_strErrorMsg;
		}

		CAccountTransferSerial::CAccountTransferSerial()
		{
			m_nPlateSerial = 0;
			m_strTradingDay = "";
			m_str_TradeCode = "";
			m_strInvestorId = "";
			m_dTradeAmount = 0;
			m_dCustFee = 0;
			m_dBrokerFee = 0;
			m_nAvailabilityFlag = 0;
			m_strOperatorCode = "";
			m_strBankNewAccount = "";
			m_nErrorId = 0;
			m_strErrorMsg = "";
		}

		CAccountTransferSerial::~CAccountTransferSerial()
		{

		}

		CAccountTransferSerial::CAccountTransferSerial(const CAccountTransferSerial& r)
		{
			CAccountRegisterBank* pBank = (CAccountRegisterBank*)(&r);
			this->CAccountRegisterBank::CAccountRegisterBank(*pBank);

			m_nPlateSerial = r.m_nPlateSerial;
			m_strTradingDay = r.m_strTradingDay;
			m_str_TradeCode = r.m_str_TradeCode;
			m_strInvestorId = r.m_strInvestorId;
			m_dTradeAmount = r.m_dTradeAmount;
			m_dCustFee = r.m_dCustFee;
			m_dBrokerFee = r.m_dBrokerFee;
			m_nAvailabilityFlag = r.m_nAvailabilityFlag;
			m_strOperatorCode = r.m_strOperatorCode;
			m_strBankNewAccount = r.m_strBankNewAccount;
			m_nErrorId = r.m_nErrorId;
			m_strErrorMsg = r.m_strErrorMsg;
		}

		CTransferBank::CTransferBank()
		{
			m_nProviderId = -1;
			m_strBankId = "";
			m_strBankBrchId = "";
			m_strBankName = "";
			m_bActive = 1;
		}

		CTransferBank::~CTransferBank()
		{
			
		}
	}
}